// let arr = [1, 2, 3, 4, 5]
// let num1 = arr.find(item => item == 2)
// let num2 = arr.forEach(item => {
//     // console.log(item)
// })
// let num3 = arr.map(item => item + 1)
// let num4 = arr.filter(item => item % 2)
// console.log(num4)


// json数据格式分为对象形和数组形式
// let json1 = { name: 'feng', age: 18 }
let json2 = [{ name: 'feng', age: 18 }, { name: 'zhi', age: 20 }]
    // console.log(JSON.parse(JSON.stringify(json2)));

// for in遍历
for (const key in json2) {
    // console.log(key)
    // console.log(json2[key])
}
let str = 'fengzhilun'
    // console.log(str.startsWith('ng'))
    // console.log(str.endsWith('u'));
    // console.log(str.includes('zh'))
    // 模板字符串
    // console.log(`${str}你好`)
    // 结构赋值
let [x, y, z] = [1, 2, 3, 4]
let { name: a, age: b } = { name: 'feng', age: 20 }
// console.log(x, y, z)
// console.log(a, b)



// assign 方法的使用 方法用于将所有可枚举属性的值从一个或多个源对象复制到目标对象
let obj1 = { name: "fe" }
let obj2 = { name: 'zh' }

// console.log(Object.assign(obj1, obj2, ))

// promise
let pro1 = new Promise((r, j) => {
    setTimeout(() => {
        // console.log('chenggong')
        r()
    }, 1000);
})
pro1.then(a => {
    // console.log(a)
}, b => {
    // console.log(b)
})

// 生成器函数
function* abc() {
    yield "123"
}
let bar = abc()
console.log(bar.next())